﻿using FluentNHibernate.Mapping;
using YunBox2.Contracts.FoundationModels;

namespace YunBox2.DAL.Maps
{
	public class UOMMap : ClassMap<UOM>
	{
		public UOMMap()
		{
			Id(x => x.Id).GeneratedBy.Guid().Default("(newid())").Column("Id");
			Map(x => x.Name).Length(32).Not.Nullable().Unique().Column("Name");
			Map(x => x.Symbol).Length(16).Not.Nullable().Unique().Column("Symbol");
			Map(x => x.Type).Not.Nullable().Default("1").CustomType(typeof (int)).Column("Type");
			Map(x => x.Rate).Default("1.0").Column("Rate");
			Map(x => x.IsReadOnly).Default("0").Column("IsReadOnly");

			//Map(Reveal.Member<UOM>("_isLock"));

			Map(x => x.LastModifiedTime);
			References(x => x.LastModifiedUser).Column("LastModifiedUserID");
			Table("UOM");
		}
	}
}